package com.gitee.minimalismstyle.fresh.flowable.api.service.impl

import com.gitee.minimalismstyle.fresh.common.core.domain.R
import com.gitee.minimalismstyle.fresh.flowable.api.feign.TasksApi
import com.gitee.minimalismstyle.fresh.flowable.api.feign.model.TaskActionRequest
import com.gitee.minimalismstyle.fresh.flowable.api.model.FlowSubmitData
import com.gitee.minimalismstyle.fresh.flowable.api.service.FlowSubmitService
import org.springframework.beans.factory.annotation.Autowired

abstract class FlowSubmitServiceImpl<T> : FlowSubmitService<T> {

    @Autowired
    lateinit var tasksApi: TasksApi

    override fun submit(flowSubmitData: FlowSubmitData<T>): R<FlowSubmitData<T>> {
        val taskActionRequest = TaskActionRequest()
        val r = tasksApi.executeTaskAction(flowSubmitData.taskAction.taskId!!, taskActionRequest)
        return R.success(flowSubmitData)
    }
}